package com.itheima.mall.service.cms;

import com.itheima.mall.api.cms.SubjectServiceApi;
import com.itheima.mall.pojo.cms.Subject;
import com.itheima.mall.vo.PageResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubjectService {
    @DubboReference
    private SubjectServiceApi subjectServiceApi;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

/**
     * 根据专题名称分页获取商品专题
     * @param keyword  搜索的关键字（名称模糊搜索）
     * @param pageNum
     * @param pageSize
     * @return
     */

    public PageResult listByName(String keyword, Integer pageNum, Integer pageSize) {
        //1、根据专题名称到mysql中查所有商品专题信息
        return subjectServiceApi.findPageByName(keyword,pageNum,pageSize);

    }

/**
     * 获取全部商品专题
     * @return
     */

    public List<Subject> listAll() {
        //1、查询所有商品专题
        List<Subject> subjectList = subjectServiceApi.listAll();
        return subjectList;
    }
}
